﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
	String path = request.getContextPath();
	String basePath = "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/">
<!-- 下拉框 -->
<link rel="stylesheet" href="static/ace/css/chosen.css" />
<!-- jsp文件头和头部 -->
<%@ include file="../../system/index/top.jsp"%>
<!-- 日期框 -->
<link rel="stylesheet" href="static/ace/css/datepicker.css" />
</head>
<body class="no-skin">

	<!-- /section:basics/navbar.layout -->
	<div class="main-container" id="main-container">
		<!-- /section:basics/sidebar -->
		<div class="main-content">
			<div class="main-content-inner">
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
							<!-- 检索  -->
							<form action="mult/multGoods" method="post"
								name="userForm" id="userForm">
								<table  style="margin-top: 5px;">
									<tr>
										<td>
											<div class="nav-search">
												<span class="input-icon"> <input
													class="nav-search-input" autocomplete="off"
													id="nav-search-input" type="text" name="title"
													value="${pd.title }" placeholder="这里输入商品名" /> <i
													class="ace-icon fa fa-search nav-search-icon"></i>
												</span>
											</div>
										</td>
										<!-- <td class="user-count-key" ></td> -->
										<td class="user-count-value">下单日期:&nbsp;&nbsp;&nbsp;
	                                    <input class="span10 date-picker" name="startTime"
	                                      id="startTime" value="${pd.startTime}"
	                                      type="text" data-date-format="yyyy-mm-dd"
	                                      style="width:88px;" placeholder="开始时间"
	                                      title="开始时间"/>-
	                                    <input class="span10 date-picker" name="endTime"
	                                      id="endTime" value="${pd.endTime}" type="text"
	                                      data-date-format="yyyy-mm-dd"
	                                      style="width:88px;" placeholder="结束时间"
	                                      title="结束时间"/></td>
	                                      
										<c:if test="${QX.toExcel == 1 }">
                                        <td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs"
                                                                                            onclick="toExcel();"
                                                                                            title="导出到EXCEL"><i
                                                id="nav-search-icon"
                                                class="ace-icon fa fa-download bigger-110 nav-search-icon blue"></i></a>
                                        </td>
                                    </c:if>
                                    	<c:if test="${QX.cha == 1 }">
											<td style="vertical-align: top; padding-left: 2px;"><a
												class="btn btn-light btn-xs" onclick="searchs();" title="检索"><i
													id="nav-search-icon"
													class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a>
										</c:if>
									</tr>
									<tr>
										<td class="user-count-key" style="color: red">数量:&nbsp;&nbsp;&nbsp; ${pd.num }&nbsp;件&nbsp;&nbsp;&nbsp;&nbsp;总金额:&nbsp;&nbsp;&nbsp; ${pd.price }&nbsp;元</td>
									</tr>
								</table>

								<!-- 检索  -->
								<table id="simple-table"
									class="table table-striped table-bordered table-hover"
									style="margin-top: 5px;">
									<thead>
										<tr>
											<th class="center" style="width: 50px;">ID</th>
											<th class="center">期数</th>
											<th class="center">商品名</th>
											<th class="center">下单时间</th>
											<th class="center">总金额</th>
											<th class="center">件数</th>
											<th class="center">用户昵称</th>
											<th class="center">手机号</th>
										</tr>
									</thead>
									<tbody>

										<!-- 开始循环 -->
										<c:choose>
											<c:when test="${not empty multGoods}">
												<c:if test="${QX.cha == 1 }">
													<c:forEach items="${multGoods}" var="user" varStatus="vs">
														<tr>
															<td class='center' style="width: 30px;">${user.goods_id}</td>
															<td class="center">${user.period }&nbsp;期</td>
															<td class="center">${user.title }</td>
															<td class="center">${user.create_time }</td>
															<td class="center">${user.real_price }&nbsp;元</td>
															<td class="center">${user.number }&nbsp;件</td>
															<td class="center">${user.petName }</td>
                                                            <td class="center">${user.phone}</td>
														<%-- 	<td class="center"><c:if
																	test="${QX.edit != 1 && QX.del != 1 }">
																	<span
																		class="label label-large label-grey arrowed-in-right arrowed-in"><i
																		class="ace-icon fa fa-lock" title="无权限"></i></span>
																</c:if>
																<div class="hidden-sm hidden-xs btn-group">
																	
																	<c:if test="${QX.cha == 1 }">
																		<a class="btn btn-xs" 
																				onclick="details('${user.user_id }');">
																				查看详情
																			</a>
																	</c:if>
																	
																</div>
																<div class="hidden-md hidden-lg">
																	<div class="inline pos-rel">
																		<button
																			class="btn btn-minier btn-primary dropdown-toggle"
																			data-toggle="dropdown" data-position="auto">
																			<i class="ace-icon fa fa-cog icon-only bigger-110"></i>
																		</button>
																		<ul
																			class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
																		
																		
																		</ul>
																	</div>
																</div></td> --%>
														</tr>
													</c:forEach>
												</c:if>
												<c:if test="${QX.cha == 0 }">
													<tr>
														<td colspan="100" class="center">您无权查看</td>
													</tr>
												</c:if>
											</c:when>
											<c:otherwise>
												<tr class="main_info">
													<td colspan="100" class="center">没有相关数据</td>
												</tr>
											</c:otherwise>
										</c:choose>
									</tbody>
								</table>
								<div class="page-header position-relative">
									<table style="width: 100%;">
										<tr>
											<td style="vertical-align: top;"><div class="pagination"
													style="float: right; padding-top: 0px; margin-top: 0px;">${page.pageStr}</div></td>
										</tr>
									</table>
								</div>
							</form>
						</div>
						<!-- /.col -->
					</div>
					<!-- /.row -->
				</div>
				<!-- /.page-content -->
			</div>
		</div>
		<!-- /.main-content -->
		<!-- 返回顶部 -->
		<a href="#" id="btn-scroll-up"
			class="btn-scroll-up btn btn-sm btn-inverse"> <i
			class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
		</a>
	</div>
	<!-- /.main-container -->
	<!-- basic scripts -->
	<!-- 页面底部js¨ -->
	<%@ include file="../../system/index/foot.jsp"%>
	<!-- 删除时确认窗口 -->
	<script src="static/ace/js/bootbox.js"></script>
	<!-- ace scripts -->
	<script src="static/ace/js/ace/ace.js"></script>
	<!-- 日期框 -->
	<script src="static/ace/js/date-time/bootstrap-datepicker.js"></script>
	<!-- 下拉框 -->
	<script src="static/ace/js/chosen.jquery.js"></script>
	<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
</body>
<script type="text/javascript">
		$(top.hangge());
		
		$(function() {
			//日期框
			$('.date-picker').datepicker({autoclose: true,todayHighlight: true});
			
			//下拉框
			if(!ace.vars['touch']) {
				$('.chosen-select').chosen({allow_single_deselect:true}); 
				$(window)
				.off('resize.chosen')
				.on('resize.chosen', function() {
					$('.chosen-select').each(function() {
						 var $this = $(this);
						 $this.next().css({'width': $this.parent().width()});
					});
				}).trigger('resize.chosen');
				$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
					if(event_name != 'sidebar_collapsed') return;
					$('.chosen-select').each(function() {
						 var $this = $(this);
						 $this.next().css({'width': $this.parent().width()});
					});
				});
				$('#chosen-multiple-style .btn').on('click', function(e){
					var target = $(this).find('input[type=radio]');
					var which = parseInt(target.val());
					if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
					 else $('#form-field-select-4').removeClass('tag-input-style');
				});
			}
			
			//复选框全选控制
			var active_class = 'active';
			$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
				var th_checked = this.checked;//checkbox inside "TH" table header
				$(this).closest('table').find('tbody > tr').each(function(){
					var row = this;
					if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
					else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
				});
			});
		});
		
		//检索
		function searchs(){
			top.jzts();
			$("#userForm").submit();
		}
	
		
		//导出excel
	    function toExcel() {
			
	        var title = $("#title").val();
	        if(title===undefined){
	        	title='';
	        }
	        var startTime = $("#startTime").val();
	        var endTime = $("#endTime").val();
	        var pageNum = '${page.currentPage}';
	        var showCount = '${page.showCount}';
	        window.location.href = '<%=basePath%>mult/multGoodsExcel.do?title=' + title +'&startTime=' + startTime + '&endTime=' + endTime + '&pageNum='+pageNum+'&showCount='+showCount;
	    }
		
		//个人详情
		function details(id){
			 top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="个人详情";
			 diag.URL = '<%=basePath%>fruitUser/details.do?id='+id+'&jump=02';
			 diag.Width =900;
			 diag.Height =530;
			 diag.CancelEvent = function(){ //关闭事件
					 if('${page.currentPage}' == '0'){
						 top.jzts();
						 setTimeout("self.location=self.location",100);
					 }else{
						 nextPage('${page.currentPage}');
					 }
				diag.close();
			 };
			 diag.show();
		}
	
		
		//去 修改数值 页面
		function editUserCompany(userId){
			
			window.location.href="<%=basePath%>real/toCompany.do?"+userId;

		}
		
		function reset(){
			 window.location.href='<%=basePath%>fruitUser/listConsumeUsers.do?sort=01';
		}
		
		// 去编辑
	
		
		</script>
</html>
